package com.zs.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.google.gson.Gson;
import com.zs.common.config.ResponseCode;
import com.zs.mapper.UserMapper;
import com.zs.model.ResponseCodeEntity;
import com.zs.model.UserEntity;
import com.zs.model.criteria.BaseCriteria;
import com.zs.service.UserService;

/**
 * 
 * @author THINK
 *
 */
@Service("userServiceImpl")
public class UserServiceImpl implements UserService{

    @Resource
    private UserMapper userMapper;
    
    @Resource
    private Gson gson;
    @Override
	public String selectUserList(BaseCriteria baseCriteria) {
		// TODO Auto-generated method stub
    	List<UserEntity> selectUserList = userMapper.selectUserList(baseCriteria);
    	int orderCount=userMapper.getTotalCount();
    	ResponseCodeEntity responseCodeTO =new ResponseCodeEntity(ResponseCode.DATA_OK,ResponseCode.DATA_SUCESS, selectUserList, orderCount, baseCriteria.getPageSize(), baseCriteria.getPageNo());
    	return gson.toJson(responseCodeTO);
	}
	@Override
	public UserEntity checkLogin(String username, String password) {
		// TODO Auto-generated method stub
		return userMapper.checkLogin(username,password);
	}
    

	


}
